using System;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Runtime.Serialization;

namespace WcfService1.DTO
{
    [DataContract]
    public class SpkDetailDTO : INotifyPropertyChanged
    {
        private Decimal _Discount;
        private String _DiscountType;
        private InventoryDTO _Inventory;
        private ItemDTO _Item;
        private ObservableCollection<ItemDTO> _Items;
        private decimal _Lebar;
        private string _Name;
        private int _No;
        private decimal _Panjang;
        private Decimal _Price;
        private Decimal _Qty;
        private long _SpkDetailId;
        private SubGroupDTO _SubGroup;
        private ObservableCollection<SubGroupDTO> _Subgroups;
        private decimal _Tinggi;
        private Decimal _TotalDetail;


        [DataMember]
        public long SpkDetailId
        {
            get { return _SpkDetailId; }
            set
            {
                _SpkDetailId = value;
                RaisePropertyChanged("SpkDetailId");
            }
        }

        [DataMember]
        public SubGroupDTO SubGroup
        {
            get { return _SubGroup; }
            set
            {
                _SubGroup = value;
                RaisePropertyChanged("SubGroup");
            }
        }

        [DataMember]
        public Decimal Panjang
        {
            get { return _Panjang; }
            set
            {
                _Panjang = value;
                RaisePropertyChanged("Panjang");
            }
        }

        [DataMember]
        public Decimal Lebar
        {
            get { return _Lebar; }
            set
            {
                _Lebar = value;
                RaisePropertyChanged("Lebar");
            }
        }

        [DataMember]
        public Decimal Tinggi
        {
            get { return _Tinggi; }
            set
            {
                _Tinggi = value;
                RaisePropertyChanged("Tinggi");
            }
        }


        [DataMember]
        public Decimal Qty
        {
            get { return _Qty; }
            set
            {
                _Qty = value;
                RaisePropertyChanged("Qty");
            }
        }


        [DataMember]
        public Decimal Price
        {
            get { return _Price; }
            set
            {
                _Price = value;
                RaisePropertyChanged("Price");
            }
        }


        [DataMember]
        public Decimal Discount
        {
            get { return _Discount; }
            set
            {
                _Discount = value;
                RaisePropertyChanged("Discount");
            }
        }


        [DataMember]
        public String DiscountType
        {
            get { return _DiscountType; }
            set
            {
                _DiscountType = value;
                RaisePropertyChanged("DiscountType");
            }
        }


        [DataMember]
        public ItemDTO Item
        {
            get { return _Item; }
            set
            {
                _Item = value;
                RaisePropertyChanged("Item");
            }
        }


        [DataMember]
        public InventoryDTO Inventory
        {
            get { return _Inventory; }
            set
            {
                _Inventory = value;
                RaisePropertyChanged("Inventory");
            }
        }

        [DataMember]
        public Decimal TotalDetail
        {
            get { return _TotalDetail; }
            set
            {
                _TotalDetail = value;
                RaisePropertyChanged("TotalDetail");
            }
        }


        public ObservableCollection<SubGroupDTO> Subgroups
        {
            get { return _Subgroups; }
            set
            {
                _Subgroups = value;
                RaisePropertyChanged("Subgroups");
            }
        }

        public ObservableCollection<ItemDTO> Items
        {
            get { return _Items; }
            set
            {
                if (Items == value) return;
                _Items = value;
                RaisePropertyChanged("Items");
            }
        }

        public string Name
        {
            get { return _Name; }
            set
            {
                _Name = value;
                RaisePropertyChanged("Name");
            }
        }


        public int No
        {
            get { return _No; }
            set
            {
                _No = value;
                RaisePropertyChanged("No");
            }
        }

        #region INotifyPropertyChanged Members

        public event PropertyChangedEventHandler PropertyChanged;

        #endregion

        protected void RaisePropertyChanged(string propertyname)
        {
            PropertyChangedEventHandler handler = PropertyChanged;
            if (handler != null)
                handler(this, new PropertyChangedEventArgs(propertyname));
        }
    }
}